﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

using FRL.DebtChased.Repository;
using FRL.DebtChased.Silverlight.Library.RichContentService;

namespace FRL.DebtChased.Silverlight.Library
{

	/// <summary>
	/// Declaration of ReadOnlyContactAddressCtrl class
	/// Display of contact address
	/// </summary>
	public partial class ReadOnlyContactAddressCtrl : UserControl
	{

		/////////////////////////////////////////////////////////////
		// Construction

		public ReadOnlyContactAddressCtrl()
		{

			// Load xaml reosurces
			InitializeComponent();

		}

		/////////////////////////////////////////////////////////////
		// Operations

		public void Set(ContactAddressTransport address)
		{

			// Set content
			TransportSupport.AddressToTextBlockContent(address,tbAddress);

		}

		private void RequestModification_Click(object sender, EventArgs e)
		{

			// Find parent control
			ReadOnlyContactDetailsCtrl parentCtrl = this.FindParent(typeof(ReadOnlyContactDetailsCtrl)) as ReadOnlyContactDetailsCtrl;

			// Request modification
			parentCtrl.RequestModification(Definitions.eDataField.Contact_Address, 0, null);

		}

	}

}
